﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IRCServer.Utilities
{
    public static class CommandParser
    {
        public static string[] GetParameters(string message)
        {
            string[] colonSplit = message.Split(new char[] { ':' });

            if (colonSplit.Length == 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            string[] spaceSplit = colonSplit[0].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (spaceSplit.Length == 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            
            return spaceSplit.Concat(colonSplit.Except(new List<string>() { colonSplit[0] })).ToArray();
        }
    }
}
